#include<iostream>
using namespace std;
const int N = 1e6 + 10;
int primes[N];
int n, k;
int cnt;
bool st[N];
void get_prime(int n)
{
	for (int i = 2; i <= n; i++) {
		if (!st[i])primes[++cnt] = i;
		for (int j = 1; primes[j] <= n / i; j++) {
			st[primes[j] * i] = 1;
			if (i % primes[j] == 0)break;
		}
	}
}
int main()
{
	cin >> n >> k;
	get_prime(n);
	while (k--) {
		int x;
		scanf("%d", &x);
		if (x > n || x == 1) {
			cout << "no" << endl;
			continue;
		}
		if (!st[x])cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return	0;
}